package ar.pmt.vista.jsonServlet;

import java.util.ArrayList;
import java.util.Collection;

import ar.pmt.vista.jsonServlet.core.JsonError;

public class PmtJsonOut {
	
	
	private Collection<?> outCollection; 
	
	private Object outObject;
	
	private Collection<JsonError> errors;

	/**
	 * @return the outCollection
	 */
	public final Collection<?> getOutCollection() {
		return outCollection;
	}

	/**
	 * @return the outObject
	 */
	public final Object getOutObject() {
		return outObject;
	}

	/**
	 * @return the errors
	 */
	public final Collection<JsonError> getErrors() {
		return errors;
	}

	/**
	 * @param outCollection the outCollection to set
	 */
	public final void setOutCollection(Collection<?> outCollection) {
		this.outCollection = outCollection;
	}

	/**
	 * @param outObject the outObject to set
	 */
	public final void setOutObject(Object outObject) {
		this.outObject = outObject;
	}

	/**
	 * @param errors the errors to set
	 */
	public final void setErrors(Collection<JsonError> errors) {
		this.errors = errors;
	}
	
	/**
	 * Agregar Nuevo Errores
	 * @param id de Error
	 * @param msg Mensaje
	 */
	public final void addErrors(String id, String msg) {
		if (getErrors()==null){
			errors = new ArrayList<JsonError>();
		}
		JsonError jsonError = new JsonError();
		jsonError.setId(id);
		jsonError.setMsg(msg);
		errors.add(jsonError);
	}
	
	
	
	

}
